<?php echo $this->window(array('title' => 'Zugriffsberechtigung vergeben'))?>
        <form id="roleList" name="roleList" method="post">
            <select name="roleIdSelect" onchange="submitform('roleList')">
                <option value="">Role auswählen</option>
                <?php foreach($this->roleList as $id => $role) : ?>
                <option value="<?php echo $id?>"
                <?php if ($this->roleIdSelect == $id) :?>
                    selected="selected"
                <?php endif;?>
                ><?php echo $role?></option>
                <?php endforeach;?>
            </select>
            <input type="hidden" name="roleListSelect" value="1"> 
        </form>
        
        <?php if($this->moduleList) :?>
        <form id="ruleList" name="ruleList" method="post">
            <fieldset>
                <legend>Administrator</legend>
                <label>
                    <input type="checkbox" name="data[administrator]" value="allow"
                    <?php if($this->moduleList == 'admin') :?>
                    checked
                    <?php endif;?>
                    >
                    Alle Rechte
                </label>
            </fieldset>
            <?php if(is_array($this->moduleList)) :?>
            <?php foreach($this->moduleList as $app => $typ) : ?>
            <fieldset>
                <legend><?php echo $typ['app']['name']?></legend>
                <?php foreach($typ['controller'] as $controller => $name) : ?>
                <fieldset>
                    <legend><?php echo $name?></legend>
                    <?php foreach($typ['action'][$controller] as $action => $label) : ?>
                    <label>
                        <input type="checkbox" name="data[<?php echo $app?>][<?php echo $controller?>][]" value="<?php echo $action?>"
                        <?php if(isset($typ['access'][$controller][$action])) :?>
                        checked
                        <?php endif;?>
                        >
                        <?php echo $label?>
                    </label>
                    <?php endforeach;?>
                </fieldset>
                <?php endforeach;?>
            </fieldset>
            <?php endforeach;?>
            <?php endif;?>
            <input type="hidden" name="roleIdSelect" value="<?php echo $this->roleIdSelect?>"> 
        </form>
        <?php endif;?>
<?php echo $this->window()?>